import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;

public class AltLoader extends BiomeTerrainBaseMod {

	HashMap<String, String> settingsHash;
	HashMap<Byte, BlockWrapper> replacementMapping;
	HashMap<String,BlockWrapper> nameMapping;
	String settingsFile;

	AltLoader() {
		// TODO actually put where to look for the ini file, this is a stub to
		// make my life easier
		this.settingsFile = "btm.ini";
	}
	private void parseReplaceMod(String data)
	{
		data.replace("replace", "");
		String ogBlock=data.split(":")[0];
		String newBlock=data.split(":")[1];
		
	}
	private BlockWrapper parseName(String data)
	{
		BlockWrapper bw= new BlockWrapper();
		
		return bw;
	}
	public void readSettings() {
		BufferedReader br = null;
		try {
			File f = new File("./saves", settingsFile);
			if (!f.exists())
				f = new File(".", settingsFile);
			if (!f.exists()) {
				f.createNewFile();
			}
			br = new BufferedReader(new FileReader(f));
			String thisLine;
			while ((thisLine = br.readLine()) != null) {
				if ((!thisLine.contains("<") && (!thisLine.contains(">")))
						&& thisLine.contains(":"))
					if(thisLine.contains("replace"))
						parseReplaceMod(thisLine.toLowerCase());
					else
					settingsHash.put(thisLine.split(":")[0].trim(),
							thisLine.split(":")[1].trim());

			}

		} catch (FileNotFoundException e) {

			if (br != null) {
				try {
					br.close();
				} catch (IOException localIOException2) {
				}

			}

			if (br != null) {
				try {
					br.close();
				} catch (IOException localIOException3) {
				}

			}

			if (br != null)
				try {
					br.close();
				} catch (IOException localIOException4) {
				}
		} catch (IOException e) {
			e.printStackTrace();

			if (br != null) {
				try {
					br.close();
				} catch (IOException localIOException5) {
				}

			}

			if (br != null) {
				try {
					br.close();
				} catch (IOException localIOException6) {
				}

			}

			if (br != null)
				try {
					br.close();
				} catch (IOException localIOException7) {
				}
		} finally {
			if (br != null)
				try {
					br.close();
				} catch (IOException localIOException8) {
				}
		}
	}

}
